package com.guslegend.config;

import com.guslegend.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: guslegend
 * @description: 登录拦截器
 * @create: 2025-05-30 08:14
 **/
@Slf4j
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    public LoginInterceptor interceptor() {
        return new LoginInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor())
                //拦截的路径
                .addPathPatterns("/api/coupon/*/**", "/api/coupon_record/*/**")
                //不拦截的路径
                .excludePathPatterns("/api/coupon/*/page_coupon_list");
    }
}